/*! @file format-pec.h */
#ifndef FORMAT_PEC_H
#define FORMAT_PEC_H

#include "emb-file.h"
#include "emb-pattern.h"

#include "api-start.h"
#ifdef __cplusplus
extern "C" {
#endif

extern EMB_PRIVATE int EMB_CALL readPec(EmbPattern* pattern, const char* fileName);
extern EMB_PRIVATE int EMB_CALL writePec(EmbPattern* pattern, const char* fileName);
extern EMB_PRIVATE void EMB_CALL readPecStitches(EmbPattern* pattern, EmbFile* file);
extern EMB_PRIVATE void EMB_CALL writePecStitches(EmbPattern* pattern, EmbFile* file, const char* filename);

static const int pecThreadCount = 65;
static const EmbThread pecThreads[] = {
{{  0,   0,   0}, "Unknown",         ""}, /* Index  0 */
{{ 14,  31, 124}, "Prussian Blue",   ""}, /* Index  1 */
{{ 10,  85, 163}, "Blue",            ""}, /* Index  2 */
{{  0, 135, 119}, "Teal Green",      ""}, /* Index  3 */ /* TODO: Verify RGB value is correct */
{{ 75, 107, 175}, "Cornflower Blue", ""}, /* Index  4 */
{{237,  23,  31}, "Red",             ""}, /* Index  5 */
{{209,  92,   0}, "Reddish Brown",   ""}, /* Index  6 */
{{145,  54, 151}, "Magenta",         ""}, /* Index  7 */
{{228, 154, 203}, "Light Lilac",     ""}, /* Index  8 */
{{145,  95, 172}, "Lilac",           ""}, /* Index  9 */
{{158, 214, 125}, "Mint Green",      ""}, /* Index 10 */ /* TODO: Verify RGB value is correct */
{{232, 169,   0}, "Deep Gold",       ""}, /* Index 11 */
{{254, 186,  53}, "Orange",          ""}, /* Index 12 */
{{255, 255,   0}, "Yellow",          ""}, /* Index 13 */
{{112, 188,  31}, "Lime Green",      ""}, /* Index 14 */
{{186, 152,   0}, "Brass",           ""}, /* Index 15 */
{{168, 168, 168}, "Silver",          ""}, /* Index 16 */
{{125, 111,   0}, "Russet Brown",    ""}, /* Index 17 */ /* TODO: Verify RGB value is correct */
{{255, 255, 179}, "Cream Brown",     ""}, /* Index 18 */
{{ 79,  85,  86}, "Pewter",          ""}, /* Index 19 */
{{  0,   0,   0}, "Black",           ""}, /* Index 20 */
{{ 11,  61, 145}, "Ultramarine",     ""}, /* Index 21 */
{{119,   1, 118}, "Royal Purple",    ""}, /* Index 22 */
{{ 41,  49,  51}, "Dark Gray",       ""}, /* Index 23 */
{{ 42,  19,   1}, "Dark Brown",      ""}, /* Index 24 */
{{246,  74, 138}, "Deep Rose",       ""}, /* Index 25 */
{{178, 118,  36}, "Light Brown",     ""}, /* Index 26 */
{{252, 187, 197}, "Salmon Pink",     ""}, /* Index 27 */ /* TODO: Verify RGB value is correct */
{{254,  55,  15}, "Vermillion",      ""}, /* Index 28 */
{{240, 240, 240}, "White",           ""}, /* Index 29 */
{{106,  28, 138}, "Violet",          ""}, /* Index 30 */
{{168, 221, 196}, "Seacrest",        ""}, /* Index 31 */
{{ 37, 132, 187}, "Sky Blue",        ""}, /* Index 32 */
{{254, 179,  67}, "Pumpkin",         ""}, /* Index 33 */
{{255, 243, 107}, "Cream Yellow",    ""}, /* Index 34 */
{{208, 166,  96}, "Khaki",           ""}, /* Index 35 */
{{209,  84,   0}, "Clay Brown",      ""}, /* Index 36 */
{{102, 186,  73}, "Leaf Green",      ""}, /* Index 37 */
{{ 19,  74,  70}, "Peacock Blue",    ""}, /* Index 38 */
{{135, 135, 135}, "Gray",            ""}, /* Index 39 */
{{216, 204, 198}, "Warm Gray",       ""}, /* Index 40 */ /* TODO: Verify RGB value is correct */
{{ 67,  86,   7}, "Dark Olive",      ""}, /* Index 41 */
{{253, 217, 222}, "Flesh Pink",      ""}, /* Index 42 */ /* TODO: Verify RGB value is correct */
{{249, 147, 188}, "Pink",            ""}, /* Index 43 */
{{  0,  56,  34}, "Deep Green",      ""}, /* Index 44 */
{{178, 175, 212}, "Lavender",        ""}, /* Index 45 */
{{104, 106, 176}, "Wisteria Violet", ""}, /* Index 46 */
{{239, 227, 185}, "Beige",           ""}, /* Index 47 */
{{247,  56, 102}, "Carmine",         ""}, /* Index 48 */
{{181,  75, 100}, "Amber Red",       ""}, /* Index 49 */ /* TODO: Verify RGB value is correct */
{{ 19,  43,  26}, "Olive Green",     ""}, /* Index 50 */
{{199,   1,  86}, "Dark Fuschia",    ""}, /* Index 51 */ /* TODO: Verify RGB value is correct */
{{254, 158,  50}, "Tangerine",       ""}, /* Index 52 */
{{168, 222, 235}, "Light Blue",      ""}, /* Index 53 */
{{  0, 103,  62}, "Emerald Green",   ""}, /* Index 54 */ /* TODO: Verify RGB value is correct */
{{ 78,  41, 144}, "Purple",          ""}, /* Index 55 */
{{ 47, 126,  32}, "Moss Green",      ""}, /* Index 56 */
{{255, 204, 204}, "Flesh Pink",      ""}, /* Index 57 */ /* TODO: Verify RGB value is correct */ /* TODO: Flesh Pink is Index 42, is this Index incorrect? */
{{255, 217,  17}, "Harvest Gold",    ""}, /* Index 58 */
{{  9,  91, 166}, "Electric Blue",   ""}, /* Index 59 */
{{240, 249, 112}, "Lemon Yellow",    ""}, /* Index 60 */
{{227, 243,  91}, "Fresh Green",     ""}, /* Index 61 */
{{255, 153,   0}, "Orange",          ""}, /* Index 62 */ /* TODO: Verify RGB value is correct */ /* TODO: Orange is Index 12, is this Index incorrect? */
{{255, 240, 141}, "Cream Yellow",    ""}, /* Index 63 */ /* TODO: Verify RGB value is correct */ /* TODO: Cream Yellow is Index 34, is this Index incorrect? */
{{255, 200, 200}, "Applique",        ""}  /* Index 64 */
};

static const char imageWithFrame[38][48] = {
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0},
{0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0},
{0,0,1,0,0,0,0,0,0,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